#ifndef QDESIGNERACTIONS_H
#define QDESIGNERACTIONS_H

#include <QObject>

class QDesignerWorkbench;

class QDir;
class QTimer;
class QAction;
class QActionGroup;
class QDesignerFormEditorInterface;
class QDesignerFormWindowInterface;
class AppFontDialog;

class QRect;
class QWidget;
class QPixmap;
class QMenu;


class QDesignerActions : public QObject
{
    Q_OBJECT
public:
    explicit QDesignerActions(QObject *parent = 0);

    bool saveForm(QDesignerFormWindowInterface *fw);
    //bool readInForm(const QString &fileName);
    bool writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName);

    QActionGroup *fileActions() const {return m_fileActions;}
    QActionGroup *formActions() const {return m_formActions;}
    QActionGroup *toolActions() const {return m_toolActions;}
    QActionGroup *editActions() const {return m_editActions;}
    QActionGroup *windowActions() const {return m_windowActions;}
    QActionGroup *projectActions() const {return m_projectActions;}

    QAction *minimizeAction() const {return m_minimizeAction;}
    // edit mode actions
    QAction *editWidgets() const {return m_editWidgetsAction;}
    // Form actions
    QAction *openFormAction() const {return m_openFormAction;}
    QAction *closeFormAction() const {return m_closeFormAction;}
    QAction *quitAction() const {return m_quitAction;}

    bool readInForm(const QString &fileName);

    bool openForm(QWidget *parent);
    QString uiExtension() const;
    void setWindowListSeparatorVisible(bool visible);


    static const char *defaultToolbarPropertyName;

public slots:
    void createForm();
    void slotOpenForm();
    void desingerSettings();
    void projectStateChanged();

private slots:
    void saveForm();
    void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow);    
    void saveProject();
    void newProject();
    void openProject();
    void closeProject();
    void shutdown();
    void editWidgetsSlot();
    void showNewFormDialog(const QString &fileName);

private:
    QRect fixDialogRect(const QRect &rect) const;

    bool saveFormAs(QDesignerFormWindowInterface *fw);

    QDesignerWorkbench *m_workbench;
    QDesignerFormEditorInterface *m_core;

    QString m_openDirectory;
    QString m_saveDirectory;

    QActionGroup *m_fileActions;
    QActionGroup *m_formActions;
    QActionGroup *m_toolActions;
    QActionGroup *m_editActions;
    QActionGroup *m_windowActions;
    QActionGroup *m_projectActions;

    QAction *m_newProjectAction;
    QAction *m_openProjectAction;
    QAction *m_saveProjectAction;
    QAction *m_closeProjectAction;
    QAction *m_designerSettingsAction;

    QAction *m_newFormAction;
    QAction *m_openFormAction;
    QAction *m_saveFormAction;
    QAction *m_closeFormAction;
    QAction *m_previewFormAction;

    QAction *m_editWidgetsAction;

    // Project actions
    QAction *m_projectSettingsAction;
    QAction *m_projectDatabaseAction;
    QAction *m_projectScriptAction;
    QAction *m_runProjectAction;

    QAction *m_minimizeAction;   

    QAction *m_windowListSeparatorAction;
    QAction *m_quitAction;
};

#endif // QDESIGNERACTIONS_H
